home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 April / enter-2004-04.iso / files / httrack-3.30.exe / {app} / src / htsserver.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-10-04  |  4.3 KB  |  150 lines

  1. /* ------------------------------------------------------------ */
  2. /*
  3. HTTrack Website Copier, Offline Browser for Windows and Unix
  4. Copyright (C) Xavier Roche and other contributors
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  
  20.  
  21. Important notes:
  22.  
  23. - We hereby ask people using this source NOT to use it in purpose of grabbing
  24. emails addresses, or collecting any other private information on persons.
  25. This would disgrace our work, and spoil the many hours we spent on it.
  26.  
  27.  
  28. Please visit our Website: http://www.httrack.com
  29. */
  30.  
  31.  
  32. /* ------------------------------------------------------------ */
  33. /* File: Mini-server                                            */
  34. /* Author: Xavier Roche                                         */
  35. /* ------------------------------------------------------------ */
  36.  
  37. // Fichier intercepteur d'URL .h
  38.  
  39. #ifndef HTS_SERVER_DEFH
  40. #define HTS_SERVER_DEFH 
  41.  
  42. #include "htsbasenet.h"
  43.  
  44. // Fonctions
  45. void socinput(T_SOC soc,char* s,int max);
  46. T_SOC smallserver_init_std(int* port_prox,char* adr_prox);
  47. T_SOC smallserver_init(int* port,char* adr);
  48. int smallserver(T_SOC soc,char* url,char* method,char* data, char* path);
  49.  
  50. #define CATCH_RESPONSE \
  51.   "HTTP/1.0 200 OK\r\n"\
  52.   "Content-type: text/html\r\n"\
  53.   "\r\n"\
  54.   "<!-- Generated by HTTrack Website Copier -->\r\n"\
  55.   "<HTML><HEAD>\r\n"\
  56.   "<TITLE>Link caught!</TITLE>\r\n"\
  57.   "<SCRIPT LANGUAGE=\"Javascript\">\r\n"\
  58.   "<!--\r\n"\
  59.   "function back() {\r\n"\
  60.   "  history.go(-1);\r\n"\
  61.   "}\r\n"\
  62.   "// -->\r\n"\
  63.   "</SCRIPT>\r\n"\
  64.   "</HEAD>\r\n"\
  65.   "<BODY>\r\n"\
  66.   "<H2>Link captured into HTTrack Website Copier, you can now restore your proxy preferences!</H2>\r\n"\
  67.   "<BR><BR>\r\n"\
  68.   "<H3><A HREF=\"javascript:back();\">Clic here to go back</A></H3>\r\n"\
  69.   "</BODY></HTML>"\
  70.   "<!-- Generated by HTTrack Website Copier -->\r\n"\
  71.   "\r\n"\
  72.  
  73.  
  74. /* String */
  75.  
  76. typedef struct {
  77.   char* buff;
  78.   int len;
  79.   int capa;
  80. } String;
  81.  
  82. #define STRING_EMPTY {NULL, 0, 0}
  83. #define BLK_SIZE 8192
  84. #define StringBuff(blk) ((blk)->buff)
  85. #define StringLength(blk) ((blk)->len)
  86. #define StringCapacity(blk) ((blk)->capa)
  87. #define StringClear(blk) do { \
  88.   if ((blk)->capa > 0) { \
  89.     (blk)->buff[0] = '\0'; \
  90.   }\
  91.   (blk)->len = 0; \
  92. } while(0)
  93. #define StringFree(blk) do { if ((blk)->buff != NULL) { freet((blk)->buff); (blk)->buff = NULL; } } while(0)
  94. #define StringMemcat(blk, str, size) do { \
  95.   if ((blk)->len + (int)(size) + 1 > (blk)->capa) { \
  96.     (blk)->capa = (blk)->len + (size) + BLK_SIZE; \
  97.     (blk)->buff = (char*) realloct((blk)->buff, (blk)->capa); \
  98.     assertf((blk)->buff != NULL); \
  99.   } \
  100.   if ((int)(size) > 0) { \
  101.     memcpy((blk)->buff + (blk)->len, (str), (size)); \
  102.     (blk)->len += (size); \
  103.   } \
  104.   *((blk)->buff + (blk)->len) = '\0'; \
  105. } while(0)
  106. #define StringAddchar(blk, c) do { \
  107.   char __c = (c); \
  108.   StringMemcat(blk, &__c, 1); \
  109. } while(0)
  110. static void* StringAcquire(String* blk) {
  111.   void* buff = blk->buff;
  112.   blk->buff = NULL;
  113.   blk->capa = 0;
  114.   blk->len = 0;
  115.   return buff;
  116. }
  117.  
  118. static void StringStrcat(String* blk, char* str) {
  119.   StringMemcat(blk, str, strlen(str));
  120. }
  121.  
  122.  
  123. /* Language files */
  124. int htslang_load(char* limit_to, char* apppath);
  125. void conv_printf(char* from,char* to);
  126. void LANG_DELETE(void);
  127. void LANG_INIT(char* path);
  128. int LANG_T(char* path, int l);
  129. int QLANG_T(int l);
  130. char* LANGSEL(char* name);
  131. char* LANGINTKEY(char* name);
  132. int LANG_SEARCH(char* path, char* iso);
  133. int LANG_LIST(char* path, char* buffer);
  134.  
  135. int htslang_init(void);
  136. int htslang_uninit(void);
  137.  
  138. int linput_cpp(FILE* fp,char* s,int max);
  139. void unescapehttp(char* s, String* tempo);
  140. void unescapeini(char* s, String* tempo);
  141.  
  142. int smallserver_setkey(char* key, char* value);
  143. int smallserver_setkeyint(char* key, LLint value);
  144. int smallserver_setkeyarr(char* key, int id, char* key2, char* value);
  145.  
  146. #endif
  147.  
  148.  
  149.  
  150.